package org.neframework.webtest.action.task;

import java.util.List;
import java.util.Map;

import org.neframework.webtest.base.BaseController;
import org.neframework.webtest.model.t_fk_role;
import org.neframework.webtest.model.t_fk_user;
import org.neframework.webtest.util.web.session.SessionTools;

import com.tmsps.neframework.core.utils.JsonTools;
import com.tmsps.neframework.mvc.annotation.Controller;
import com.tmsps.neframework.mvc.annotation.RequestMapping;
import com.tmsps.neframework.mvc.annotation.ResponseBody;
import com.tmsps.neframework.mvc.utils.task.TaskTools;

@Controller
@RequestMapping("/cp/task")
public class TaskController extends BaseController {

	@RequestMapping("/my_task_data")
	@ResponseBody
	public String my_task_data() {

		List<Map<String, Object>> list = null;

		t_fk_user admin = SessionTools.getCurrentLoginAdmin(req);
		t_fk_role role = (t_fk_role) oc.findObjById(admin.getRole_id(), t_fk_role.class);
		if (role != null) {
			list = TaskTools.loopTask(role.getAuth_codes());
		}

		logger.info("Task-->" + list);

		return JsonTools.toJson(list);

	}

	@RequestMapping("/info")
	public String list() {
		return "/jsp/role/role/list.jsp";
	}

}
